package com.victor.zjbj_android;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.blankj.utilcode.util.BarUtils;
import com.victor.zjbj_android.mod.login.LoginActivity;
import com.victor.zjbj_android.utils.MainUtils;

public class WelcomeActivity extends AppCompatActivity {


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        init();
    }



    protected void init() {
        BarUtils.setStatusBarAlpha(WelcomeActivity.this,0);
        jumpToNext();
    }

    private void jumpToNext() {
        new Handler().postDelayed(() -> {
            if(MainUtils.isOnline(this)){
                startActivity(new Intent(WelcomeActivity.this,MainActivity.class));
                finish();
            }else{
                startActivity(new Intent(WelcomeActivity.this,LoginActivity.class));
                finish();
            }
        }, 2000);
    }

}
